<template>
  <div>
    <!-- <van-search
      autofocus
      show-action
      shape="round"
      v-model="value"
      placeholder="请输入搜索关键词"
      @search="onSearch"
    >
    </van-search> -->
    <search />
      <template >
          <search-list
          v-for="(item,index) in data"
          :item = "item"
          :key="index"
          />
      </template>
      
  </div>
</template>

<script>
import SearchList from '@/components/SearchList.vue';
import Search from '@/components/Search.vue';
  // console.log(1);
  
export default {
  components: { SearchList, Search },
  data() {
    return {
      data:[],
    }
  },
  props: ['value'],
  mounted(){
    this.onSearch();
  },
  watch:{
    value(){
      this.onSearch();
    }
  },
  methods:{
    onSearch(){
      const url = `http://10.36.4.254:8080/seach/findMovie?pageNum=1&pageSize=3&query=` + this.value;
      this.axios.get(url).then((res)=>{
        // console.log(this.value);
        console.log(res.data.data.records);
        this.data = res.data.data.records;
      })
      this.$router.push('/searchResult/' + this.value)
    
    }
  },
}

</script>

<style>

</style>